/*
 * AddElementToWorldMouseListener.hpp
 *
 *  Created on: 07-01-2011
 *      Author: Przemek
 */

#pragma once

#include "gui/MouseListener.hpp"
#include "gui/Checkbox.hpp"
#include "world/creation/CreationState.hpp"

/*
 * Main listener for adding elements to world. When the creation state can produce a new element it updates
 * it's position to be under the mouse. When the mouse is clicked the new element is added to the world. After
 * that the tool is used to create another element. It's taking into consideration the state of control panel
 * checkboxes which controls the type of adding elements (anchored to grid and adding on mouse drag).
 */
class AddElementToWorldMouseListener: public MouseListener
{
	private:
		const Checkbox* addOnDragCheckbox;
		const Checkbox* anchorToGridCheckbox;
		CreationState* creationState;

	public:
		AddElementToWorldMouseListener(const Checkbox* addOnDragCheckbox,
				const Checkbox* anchorToGridCheckbox, CreationState* creationState);
		void mouseReleased(const MouseListener::EventArguments& arguments);
		void mouseDragged(const MouseListener::EventArguments& arguments);
		void mouseMoved(const MouseListener::EventArguments& arguments);
};

